package com.example.springbootprodb.enity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 返回给前端的数据接口的提示信息对象
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Integer code;//0 失败 1 成功
    private String msg;//结果描述
    private Object dats;//返回数据
    //增删改
    public static Result success()
    {
        return new Result(1,"success",null);
    }
    //查询
    public static Result success(Object data)
    {
        return new Result(1,"success",data);
    }
    //响应失败
    public static Result success(String msg)
    {
        return new Result(0,msg,null);
    }
}
